package com.edwin.websitebe.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ResultVO<T> {

    private String code;

    private String msg;

    private T data;

    public ResultVO<T> success() {
        this.code = "0";
        this.msg = "success";
        return this;
    }

    public ResultVO<T> success(T data) {
        this.data = data;
        return success();
    }

    public ResultVO<T> fail() {
        this.code = "1";
        this.msg = "fail";
        return this;
    }

    public ResultVO<T> fail(String code, String msg) {
        this.code = code;
        this.msg = msg;
        return this;
    }

}
